#include "AutoRotateCameraShader.h"
#include <cmath>
#include "GLFW/glfw3.h"
#include "glm/ext.hpp"
#include "glm/ext/matrix_transform.hpp"
#include "glm/glm.hpp"



mat4 AutoRotateCameraShader::createViewMatrix()
{
    // 旋转速度：20度/秒
    auto rotationSpeed = glm::radians(20.0f);
    auto angle = (float)glfwGetTime() * rotationSpeed;

    auto x = sin(angle)*9;

    auto z = cos(angle)*9;

    return lookAt(glm::vec3(x, 2.0f, z), glm::vec3(0.0f, 0.0f, 0.0f),
                  glm::vec3(0.0f, 1.0f, 0.0f));
}